import Vue from 'vue'
import '@/styles/reset.scss'
import '@/styles/common.scss'
import Element from '@/utils/element-ui'
import PwdInput from '@/components/pwd-input/index'
import PsMessage from '@/components/message/index'
import DiyDialog from '@/components/diy-dialog'
import PsMessageBox from '@/components/message-box/index'
import './theme/index.scss'
import '@/styles/index.scss'
import App from './App'
import store from './store'
import router from './router'
import './icons'
import { invokeAPi, registerInformApi, invokeAsyncAPi, reportInfo } from '@/xz-fn.js'
import * as filters from './filters'
import './directive'
import './permission'
import i18n from './lang'

Vue.use(Element)
Vue.component('pwd-input', PwdInput)
Vue.prototype.$PsMessage = PsMessage
Vue.prototype.$PsMessageBox = PsMessageBox
Vue.prototype.$DiyDialog = DiyDialog
Vue.prototype.$xz = invokeAPi
Vue.prototype.$xzAsy = invokeAsyncAPi
Vue.prototype.$xzReg = registerInformApi
Vue.prototype.$xzReportInfo = reportInfo
// register global utility filters
Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key])
})

// 注册通用Event Bus
Vue.prototype.$eventBus = new Vue()

Vue.prototype.$t = function () {
  return i18n.t(...arguments)
}
Vue.prototype.$myStore = store
Vue.config.productionTip = false
// eslint-disable-next-line
const app = new Vue({
  el: '#app',
  router,
  store,
  i18n,
  render: h => h(App)
})
